package cn.xny.txcc.web.controller;

import cn.xny.txcc.dto.PhoneCodeDto;
import cn.xny.txcc.result.JSONResult;
import cn.xny.txcc.service.CommonCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class CommonCodeController {

    @Autowired
    private CommonCodeService commonCodeService;
    //图片验证码
    @GetMapping("/verifycode/imageCode/{imageCodeKey}")
    public JSONResult getImageCode(@PathVariable("imageCodeKey") String imageCodeKey){

        String imageCode = commonCodeService.getImageCode(imageCodeKey);

        return JSONResult.success(imageCode);

    }
    //手机验证码
    @PostMapping("/verifycode/sendSmsCode")
    public JSONResult getPhoneCode(@RequestBody PhoneCodeDto  phoneCodeDto){

        commonCodeService.getPhoneCode(phoneCodeDto);

        return JSONResult.success();


    }
}
